using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Xml;

using Microsoft.MediaCenter.UI;
using McePicasa.mceFlickr;
using FlickrNet;

namespace McePicasa
{

    /// <summary>
    /// A derived thumbnail command class that stores a unique Id for easy
    /// cross-reference into a table.
    /// </summary>
    public class GalleryItem : ThumbnailCommand
    {
        public GalleryItem()
        {
        }

        public GalleryItem(ModelItem page, PicasaPhoto photo)
        {
            this.photo = photo;
            this.Owner = page;
            this.Description = photo.MyTitle;
            this.Metadata = photo.PhotoAccessor.PhotoSummary;
        }

        public GalleryItem(ModelItem page, PicasaPhoto photo, GalleryItem prevItem, GalleryItem nextItem)
            : this(page, photo)
        {
            this.prevItem = prevItem;
            this.nextItem = nextItem;
        }

        public GalleryItem(ModelItem page, PicasaAlbum album)
        {
            this.album = album;
            this.Owner = page;
            this.Description = album == null ? "Click to enter your ID" : album.MyTitle;
            this.Metadata = album == null ? "With on-screen keyboard" : string.Format(CultureInfo.CurrentCulture, "{0:D}", album.Published);
        }

        public int ItemId
        {
            get { return itemId; }
            set { itemId = value; }
        }

        public PicasaPhoto Photo
        {
            get { return photo; }
            set { photo = value; }
        }

        public PicasaAlbum Album
        {
            get { return album; }
            set { album = value; }
        }

        public GalleryItem PrevItem
        {
            get { return prevItem; }
            set { prevItem = value; }
        }

        public GalleryItem NextItem
        {
            get { return nextItem; }
            set { nextItem = value; }
        }

        private int itemId;
        private PicasaPhoto photo;
        private PicasaAlbum album;
        private GalleryItem prevItem;
        private GalleryItem nextItem;
    }

    /// <summary>
    /// Class containing items for flickr gallery
    /// </summary>
    public class GalleryItemFlickr : ThumbnailCommand
    {
        public GalleryItemFlickr()
        {
        }

        public GalleryItemFlickr(ModelItem page, Photo photo)
        {
            this.photo = photo;
            this.Owner = page;
            this.Description = photo.Title;
            this.Metadata = photo.PhotoId;
        }

        public GalleryItemFlickr(ModelItem page, Photo photo, Photo prevPhoto, Photo nextPhoto)
            : this(page, photo)
        {            
            this.prevPhoto = prevPhoto;
            this.nextPhoto = nextPhoto;
        }

        public GalleryItemFlickr(ModelItem page, Photo photo, GalleryItemFlickr prevItem, GalleryItemFlickr nextItem)
            : this(page, photo)
        {
            this.prevItem = prevItem;
            this.nextItem = nextItem;
        }        

        public GalleryItemFlickr(ModelItem page, FlickrAlbum album)
        {
            this.album = album;
            this.Owner = page;
            this.Description = album == null ? "Flickr, Click to enter your ID" : album.MyTitle;
            this.Metadata = album == null ? "With on-screen keyboard" : string.Format(CultureInfo.CurrentCulture, "{0}", album.MyTitle);
        }

        public int ItemId
        {
            get { return itemId; }
            set { itemId = value; }
        }

        public Photo Photo
        {
            get { return photo; }
            set { photo = value; }
        }

        public FlickrAlbum Album
        {
            get { return album; }
            set { album = value; }
        }

        public Photo PrevPhoto
        {
            get { return prevPhoto; }
            set { prevPhoto = value; }
        }

        public Photo NextPhoto
        {
            get { return nextPhoto; }
            set { nextPhoto = value; }
        }

        public GalleryItemFlickr PrevItem
        {
            get { return prevItem; }
            set { prevItem = value; }
        }

        public GalleryItemFlickr NextItem
        {
            get { return nextItem; }
            set { nextItem = value; }
        }

        private int itemId;
        private Photo photo;
        private FlickrAlbum album;
        private Photo prevPhoto;
        private Photo nextPhoto;
        private GalleryItemFlickr prevItem;
        private GalleryItemFlickr nextItem;
    }

    
    
    
    
    
    
    
    
    
    /// <summary>
    /// A filter (for use with FilteredContentPage.Filters) that also stores
    /// an id to filter on.
    /// </summary>
    /// <seealso cref="FilteredContentPage.Filters"/>
    public class Filter : ModelItem
    {
        public Filter(GalleryPage page, string description, int id)
            : base(page, description)
        {
            filterId = id;
        }


        public Filter(GalleryPageFlickr page, string description, int id)
            : base(page, description)
        {
            filterId = id;
        }

        public int FilterId
        {
            get { return filterId; }
            set { filterId = value; }
        }

        private int filterId;
    }


    /// <summary>
    /// A derived command class that stores a unique Id for easy
    /// cross-reference into a table as well as other extra command
    /// metadata.
    /// </summary>
    public class DetailsCommand : Command
    {
        public DetailsCommand(DetailsPage page, string description)
            : base(page, description, null)
        {
        }

        public int ItemId
        {
            get { return itemId; }
            set { itemId = value; }
        }


        [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
        public int Type
        {
            get { return actionType; }
            set { actionType = value; }
        }

        public string Value
        {
            get { return actionValue; }
            set { actionValue = value; }
        }

        private int itemId;
        private int actionType;
        private string actionValue;
    }
}
